<?php

/**
 * Contact form.
 *
 * @package    Porba
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class ContactForm extends BaseContactForm
{
  public function configure()
  {
      $this->choices = CategoryContactTable::findCategories();

      $this->choicesNew = array();
       
      //Set the records of the choices in a new array where the keys are the same as the values
      foreach($this->choices as $choice => $value){
            unset( $this->choices[$choice]);
            $newvalue = strtolower(implode(array($value)));         
            $this->choicesNew[$newvalue] = $value;       
      }
      
      unset($this['created_at'], $this['updated_at']);
      $this->widgetSchema['category_name'] = new sfWidgetFormChoice(array(
          'choices' => $this->choicesNew,
          'expanded'=> true,
      ));

      $this->validatorSchema['category_name'] = new sfValidatorChoice(array(
          'choices'=>  array_keys($this->choicesNew),
      ));
  }
}
